home *** CD-ROM | disk | FTP | other *** search
/ Digital Background Bonanza / Digital Background Bonanza - Disc 1.iso / pc / DBB1.swf / scripts / __Packages / mx / styles / CSSTextStyles.as < prev    next >
Encoding:
Text File  |  2007-03-09  |  3.4 KB  |  157 lines

  1. class mx.styles.CSSTextStyles
  2. {
  3.    var _tf;
  4.    function CSSTextStyles()
  5.    {
  6.    }
  7.    static function addTextStyles(o, bColor)
  8.    {
  9.       o.addProperty("textAlign",function()
  10.       {
  11.          return this._tf.align;
  12.       }
  13.       ,function(x)
  14.       {
  15.          if(this._tf == undefined)
  16.          {
  17.             this._tf = new TextFormat();
  18.          }
  19.          this._tf.align = x;
  20.       }
  21.       );
  22.       o.addProperty("fontWeight",function()
  23.       {
  24.          return this._tf.bold == undefined ? undefined : (!this._tf.bold ? "none" : "bold");
  25.       }
  26.       ,function(x)
  27.       {
  28.          if(this._tf == undefined)
  29.          {
  30.             this._tf = new TextFormat();
  31.          }
  32.          this._tf.bold = x == "bold";
  33.       }
  34.       );
  35.       if(bColor)
  36.       {
  37.          o.addProperty("color",function()
  38.          {
  39.             return this._tf.color;
  40.          }
  41.          ,function(x)
  42.          {
  43.             if(this._tf == undefined)
  44.             {
  45.                this._tf = new TextFormat();
  46.             }
  47.             this._tf.color = x;
  48.          }
  49.          );
  50.       }
  51.       o.addProperty("fontFamily",function()
  52.       {
  53.          return this._tf.font;
  54.       }
  55.       ,function(x)
  56.       {
  57.          if(this._tf == undefined)
  58.          {
  59.             this._tf = new TextFormat();
  60.          }
  61.          this._tf.font = x;
  62.       }
  63.       );
  64.       o.addProperty("textIndent",function()
  65.       {
  66.          return this._tf.indent;
  67.       }
  68.       ,function(x)
  69.       {
  70.          if(this._tf == undefined)
  71.          {
  72.             this._tf = new TextFormat();
  73.          }
  74.          this._tf.indent = x;
  75.       }
  76.       );
  77.       o.addProperty("fontStyle",function()
  78.       {
  79.          return this._tf.italic == undefined ? undefined : (!this._tf.italic ? "none" : "italic");
  80.       }
  81.       ,function(x)
  82.       {
  83.          if(this._tf == undefined)
  84.          {
  85.             this._tf = new TextFormat();
  86.          }
  87.          this._tf.italic = x == "italic";
  88.       }
  89.       );
  90.       o.addProperty("marginLeft",function()
  91.       {
  92.          return this._tf.leftMargin;
  93.       }
  94.       ,function(x)
  95.       {
  96.          if(this._tf == undefined)
  97.          {
  98.             this._tf = new TextFormat();
  99.          }
  100.          this._tf.leftMargin = x;
  101.       }
  102.       );
  103.       o.addProperty("marginRight",function()
  104.       {
  105.          return this._tf.rightMargin;
  106.       }
  107.       ,function(x)
  108.       {
  109.          if(this._tf == undefined)
  110.          {
  111.             this._tf = new TextFormat();
  112.          }
  113.          this._tf.rightMargin = x;
  114.       }
  115.       );
  116.       o.addProperty("fontSize",function()
  117.       {
  118.          return this._tf.size;
  119.       }
  120.       ,function(x)
  121.       {
  122.          if(this._tf == undefined)
  123.          {
  124.             this._tf = new TextFormat();
  125.          }
  126.          this._tf.size = x;
  127.       }
  128.       );
  129.       o.addProperty("textDecoration",function()
  130.       {
  131.          return this._tf.underline == undefined ? undefined : (!this._tf.underline ? "none" : "underline");
  132.       }
  133.       ,function(x)
  134.       {
  135.          if(this._tf == undefined)
  136.          {
  137.             this._tf = new TextFormat();
  138.          }
  139.          this._tf.underline = x == "underline";
  140.       }
  141.       );
  142.       o.addProperty("embedFonts",function()
  143.       {
  144.          return this._tf.embedFonts;
  145.       }
  146.       ,function(x)
  147.       {
  148.          if(this._tf == undefined)
  149.          {
  150.             this._tf = new TextFormat();
  151.          }
  152.          this._tf.embedFonts = x;
  153.       }
  154.       );
  155.    }
  156. }
  157.